import React,{useState,useEffect} from 'react';
import {getlist,} from '../api/index'
import Img from './img';

import '../App.scss'
const List = () => {
    const [list,setlist]=useState([])
  
    useEffect(()=>{
        getlist().then(resp=>{
           
            setlist(resp.data.data)
        })
   
    },[])

    return (
        <div className="dls">
           {
               list.length>0&&list.map((v,i)=>{
                   return (
                       <dl key={i}>
                           <dt>
                               <Img src={v.img} alt="" />
                           </dt>
                           <dd>
                               <p><b>{v.title}</b></p>
                               <p>￥{v.num}</p>
                               <p>{v.desc}</p>
                           </dd>
                       </dl>
                   )
               })
           }
        </div>
    );
}

export default List;
